home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / E-G / FinderHype.cpt / FinderHype / stack.txt < prev   
Text File  |  1989-02-26  |  6KB  |  217 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2725
  12. -- card count: 1
  13. -- first card id: 2998
  14. -- list block id: 2172
  15. -- print block id: 0
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 2
  19. -- free size: 23296 bytes
  20. -- total size: 49152 bytes
  21. -- stack block size: 5632 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x01208000
  24. -- modified by hypercard version: 0x01208000
  25. -- opened by hypercard version: 0x01208000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. on openstack
  69.   hide message
  70.   hide menubar
  71.   global FinderHype, cnt
  72.   put the secs into cnt
  73.   put NewMenu("FinderHype","Help...","(-","Copy/9","Rename/8","Delete/7","(-","Restart","Shutdown") into FinderHype
  74.   if FinderHype = 0 then answer("Unable to make menu 'FinderHype'")
  75.   show menubar
  76.   if the version < 1.2 then
  77.     beep 2
  78.     answer "Your copy of FinderHype is for HyperCard 1.2."
  79.   end if
  80. end openstack
  81.  
  82. on closestack
  83.   hide menubar
  84.   global FinderHype
  85.   put DeleteMenu (FinderHype) into MyMenu
  86.   pass closestack
  87. end closestack
  88.  
  89. on idle
  90.   global FinderHype, cnt
  91.   if (the secs - cnt) > 3 then
  92.     put the secs into cnt
  93.     put the time into card field "time" of card 1
  94.     showMenu(FinderHype)
  95.   end if
  96.   pass idle
  97. end idle
  98.  
  99. on domenu which
  100.   if which = "Help..." then
  101.     visual zoom out
  102.     go to this card
  103.     set visible of card field info to not visible of card field info
  104.     exit domenu
  105.   end if
  106.   if which = "Copy" then
  107.     put "Select a file to copy ..."
  108.     put filename() into oldFile
  109.     put empty
  110.     hide message
  111.     if oldfile = empty then exit domenu
  112.     put lastpathcomponent(oldfile) & ".new" into default
  113.     get copyFile(oldFile,newfilename("",default))
  114.     if it ‚↠0 then OSErr(it
  115.     exit domenu
  116.   end if
  117.   if which = "Rename" then
  118.     put "Please select a file to rename"
  119.     put filename() into renamethis
  120.     if renamethis = empty then
  121.       hide message
  122.       exit domenu
  123.     end if
  124.     hide message
  125.     put LastPathComponent(renamethis) into shortname
  126.     ask "What do you want to name this file?" with shortname
  127.     if it = shortname or it = empty then
  128.       hide message
  129.       put RenameFile(renamethis,it) into returnedthis
  130.       if returnedthis = 0 then answer "File successfully renamed."
  131.       else if returnedthis < 0 then OsErr returnedthis
  132.       else answer "Whoops, there was an error."
  133.     end if
  134.     exit domenu
  135.   end if
  136.   if which = "Delete" then
  137.     put "Please select a file to delete"
  138.     put filename() into deletethis
  139.     if deletethis = empty then
  140.       hide message window
  141.       exit domenu
  142.     end if
  143.     hide message window
  144.     get lastpathcomponent(deletethis)
  145.     answer "Delete" && quote & it & quote &"?" with "Cancel" or "OK"
  146.     if it is "Cancel" then exit domenu
  147.     put deletefile(deletethis) into returnedthis
  148.     if returnedthis = 0 then answer "File Successfully Deleted"
  149.     else if returnedthis < 0 then OsErr returnedthis
  150.     else answer "Sorry, there was an error"
  151.     exit domenu
  152.   end if
  153.   if which = "Shutdown" then
  154.     Answer "Shut Down?" with Cancel or OK
  155.     if it = "ok" then Shutdown
  156.     exit domenu
  157.   end if
  158.   if which = "Restart" then
  159.     Answer "Restart?" with Cancel or OK
  160.     if it = "ok" then DoRestart
  161.     exit domenu
  162.   end if
  163.   pass domenu
  164. end domenu
  165.  
  166.  
  167. on OsErr err
  168.   -- Translate the most common ones
  169.   if err > 0 then -- XFCN convention
  170.     put "Parameter error with function" into errstr
  171.   else if err is -59 then
  172.     put "Problem during rename" into errstr
  173.   else if err is -54 then
  174.     put "Attempt to open locked file for writing" into errstr
  175.   else if err is -46 then
  176.     put "Volume locked by software" into errstr
  177.   else if err is -45 then
  178.     put "File locked" into errstr
  179.   else if err is -44 then
  180.     put "Volume locked by hardware" into errstr
  181.   else if err is -43 then
  182.     put "File not found" into errstr
  183.   else if err is -37 then
  184.     put "Bad volume or file name" into errstr
  185.   else if err is -36 then
  186.     put "I/O error" into errstr
  187.   else if err is -35 then
  188.     put "No such volume" into errstr
  189.   else if err is -34 then
  190.     put "Disk is full" into errstr
  191.   else if err is -49 then
  192.     put "File already open for writing" into errstr
  193.   else
  194.     put "Failed with error" && err into errstr
  195.   end if
  196.   answer errstr with "OK"
  197. end OsErr
  198.  
  199. function LastPathComponent name
  200. repeat with i = the length of name down to 1
  201.   if character i of name is ":" then exit repeat
  202. end repeat
  203. if i is 1 then
  204.   if first character of name is ":" then
  205.     put 2 into i
  206.   end if
  207. else
  208.   add 1 to i -- skip the colon
  209. end if
  210. put empty into lastpath
  211. repeat with j = i to the length of name
  212.   put character j of name after lastpath
  213. end repeat
  214. return lastpath
  215. end LastPathComponent
  216.  
  217.